<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@ page import="java.util.ArrayList" %>
<%@ page import="entidades.MateriasCarrera" %>

<%
//si esta logeado
if(session.getAttribute("currentSessionUser") != null){
	session.setAttribute("paginaActiva", "MateriasCarrera");
%>

<%@ include file = "estructura/Header.jsp" %>

<div id="main">
	
	<%@ include file = "estructura/MenuAlumno.jsp" %>
		
	<div id="content">
	<h1>MATERIAS</h1><br>
		<table>
			<tr>
			<th>ID</th>
			<th>Descripción</th>

			</tr>
			<tr>
		<%
			if(request.getAttribute("materiasCarrera") != null){
				ArrayList<MateriasCarrera> listaMaterias = new ArrayList<MateriasCarrera>();
				listaMaterias = (ArrayList<MateriasCarrera>)request.getAttribute("materiasCarrera");
				for(MateriasCarrera materia: listaMaterias){
		%>
			<td>
		<%	
				out.println(materia.getId() + "</td>");
		%>
			<td>
		<%	
				out.println(materia.getDescripcion() + "</td>");
		%>
			</tr>
			
		<%
				}
			}
		%>	
		</table>
	</div>
</div>

<%@ include file = "estructura/Footer.jsp" %>

<%}else{ //no logueado, se redirecciona a login%>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="/css/style.css" type="text/css">
<meta http-equiv="refresh" content="0;URL=Login.jsp">
<title>Login</title>
</head>
<body>
</body>
</html>
<%}%>